﻿using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace BwanaBank.BankOnline.WinUI.Window.Admin
{
    public partial class Admin : System.Web.UI.MasterPage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                header_logo.ImageUrl = "~/Images/logo.png";
                header_social.ImageUrl = "~/Images/social.png";
                if (Request.Cookies["userName"] != null)
                {
                    header_account.Text = "Connecté en tant que " + Request.Cookies["userName"].Value + ".";
                }
                else if (Session["userName"] != null)
                {
                    header_account.Text = "Connecté en tant que " + Session["userName"] + ".";
                }
            }
        }
        protected void Logout(object sender, EventArgs e)
        {
            Response.Cookies["admin"].Expires = DateTime.Now.AddDays(-1);
            Response.Cookies["userName"].Expires = DateTime.Now.AddDays(-1);
            Session["admin"] = null;
            Session["userName"] = null;
            Response.Redirect("~/Home.aspx");
        }
    }
}